import face_recognition
import cv2
# 获取功能包路径
from ament_index_python.packages import get_package_share_directory 

def main():

    image_path=get_package_share_directory("demo_python_service")+"/img/OIP-C.jpeg"

    print (image_path)

    image=cv2.imread(image_path)

    # 人脸检测
    face_recognitions =face_recognition.face_locations(image,number_of_times_to_upsample=1,model='hog')

    for top,right,bottom,left in face_recognitions:

        # 绘制框
        cv2.rectangle(image,(right,top),(left,bottom),(255,0,0))

    cv2.imshow("result",image)

    cv2.waitKey(0)


